#pragma once
#include<iostream>
#include<vector>

typedef void (*task_t)();
static int sign=0;

void PrintLog()
{
    std::cout<<"我是一个打印的任务"<<std::endl;
}

void Downloaad()
{
    std::cout<<"我是一个下载的任务"<<std::endl;
}

void UpLoad()
{
    std::cout<<"我是一个上传的任务"<<std::endl;
}
class teskmanager
{
    public:
    teskmanager()
    {
        Registe(PrintLog);
        Registe(Downloaad);
        Registe(UpLoad);
    }
    ~teskmanager()
    {
        
    }
    void Registe(task_t t)
    {
        _tasks.push_back(t);
    }
    int Select()
    {
        int taskcode=sign+1;
        if(taskcode<=_tasks.size())
        {
            return taskcode;
        }
        else
        {
            return taskcode%(_tasks.size());
        }
    }
    void Execute(int n)
    {
        _tasks[n-1]();
    }
    private:
    std::vector<task_t> _tasks;
};